<template>
<div class="fixedform">

  <div class="part">
    <p class="title">关联订单流程</p>
    <div>
      <el-button class="bind" type="primary" :disabled="!editable" @click="bindOrder">关联订单</el-button>

      <ul class="related">
        <li @mouseover="handleOver(item)" @mouseout="handleOut(item)" v-for="(item, index) in relationFormInstId" :key="index">
          <span class="related-number">{{item.name}}</span>
          <span v-if="editable && item.status" class="el-icon-circle-check" style="color:rgb(103, 194, 58)"></span>
          <span v-else-if="editable" class="el-icon-circle-close" @click="changeSelect(index)"></span>
        </li>
      </ul>
    </div>
  </div>

  <div class="bind-window">
    <el-dialog title="关联订单" width="70%" :visible.sync="dialogCtrl.outerVisible">

      <el-form :inline="true">
        <el-form-item label="订单编号">
          <el-input v-model="orderNumber" placeholder="请输入订单编号"></el-input>
        </el-form-item>
        <el-form-item label="外贸合同号">
          <el-input v-model="foreignTradeContractNumber" placeholder="请输入外贸合同号"></el-input>
        </el-form-item>

        <el-form-item label="买家名称">
          <el-input v-model="buyerName" placeholder="请输入买家名称"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="queryFtc(-1)">查询</el-button>
        </el-form-item>
      </el-form>

      <!-- <el-form :inline="true">
        <el-form-item label="订单状态">
          <el-select v-model="orderStatus">
            <el-option v-for="item in orderStatusOptions" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="订单流程">
          <el-select v-model="orderProcess">
            <el-option v-for="item in orderProcessOptions" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form> -->


      <el-table v-loading="loading" :data="table1Data" style="width: 100%" border>
        <el-table-column prop="table1_orderNumber" label="订单编号" sortable width="240" :sort-method="table1Sort">
          <template slot-scope="scope">
            <span>
              <input type="checkbox" :value="scope.row.table1_id" @click="checkBox"  v-model="checkedFOrder">
              <span>{{scope.row.table1_orderNumber}}</span>
            </span>
          </template>
        </el-table-column>

        <el-table-column prop="table1_ftcNumber" label="外贸合同号" sortable>
        </el-table-column>

        <el-table-column prop="table1_buyerName" label="买家名称" sortable>
        </el-table-column>

         <el-table-column prop="table1_orderProcess" label="订单流程" sortable>
        </el-table-column>

        <el-table-column prop="table1_orderStatus" label="订单状态" sortable>
        </el-table-column>
      </el-table>

      <div class="pageing">
        <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page.currPage"
        :page-sizes="[20, 30, 50, 100]"
        :page-size="page.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.totalSize">
      </el-pagination>

      </div>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" :disabled="canNotSelect" @click="bindOuterConfirm">确定</el-button>
        <el-button @click="bindOuterCancel">取 消</el-button>
      </div>

    </el-dialog>
  </div>



  <div class="part approval">
    <p class="title">审批意见</p>
    <ul>

      <!-- <template v-if="saveData.isSalesMan">
        <li v-for="item  in saveData.approvals" class="clearfix">
            <el-row>
             <el-col :span="6"><span>{{item.approval_div_name}}:</span></el-col>
             <el-col :span="6"><span>{{item.approval_opinion}}</span></el-col>
             <el-col :span="6"><span>{{item.approval_username}}</span></el-col>
             <el-col :span="6"><span>{{item.approval_time}}</span></el-col>
           </el-row>
        </li>
      </template>
      <template v-else>
          <li v-for="item  in saveData.prevApprovals" class="clearfix">
            <el-row>
             <el-col :span="6"><span>{{item.approval_div_name}}:</span></el-col>
             <el-col :span="6"><span>{{item.approval_opinion || "未填写意见"}}</span></el-col>
             <el-col :span="6"><span>{{item.approval_username}}</span></el-col>
             <el-col :span="6"><span>{{item.approval_time}}</span></el-col>
           </el-row>
        </li>

        <li v-if="saveData.newApprovalName != '' ">
            <el-row>
             <el-col :span="6">
               <span>
                 {{saveData.newApprovalName}}
               </span>
             </el-col>
             <el-col :span="4" :offset="2">
               <span>
                 <el-input type="string" v-model="saveData.newApproval.approval_opinion" placeholder="请输入审批意见"/>
               </span>
             </el-col>
             <el-col :span="4" :offset="2">
               <span>
                 <span>{{applyName}}</span>
               </span>
             </el-col>
             <el-col :span="6"><span>{{saveData.newApproval.approval_time}}</span></el-col>
           </el-row>
        </li>

        <li v-for="item  in saveData.remainApprovals" class="clearfix">
          <el-row>
           <el-col :span="6"><span>{{item}}:</span></el-col>
         </el-row>
      </li>
      </template> -->


      <li v-for="(item, index)  in saveData.originApprovals" :key="index">
        <el-row>
          <el-col :span="6">
            <span>{{item.approval_div_name}}</span>
          </el-col>
          <el-col :span="6">
            <el-input :class="{active: item.rw == 'W'}" :readonly="item.rw == 'R'" placeholder="填写审批意见" v-model="item.approval_opinion"></el-input>
          </el-col>
          <el-col :span="4" :offset="2">
            <span>{{item.approval_username}}</span>
          </el-col>
          <el-col :span="4" :offset="2">
            <span>{{item.approval_time}}</span>
          </el-col>
        </el-row>
      </li>

    </ul>
  </div>

  <div class="part btns">
    <el-button type="primary" :disabled="!saveAndSend" @click="saveForms">保存</el-button>

    <el-dropdown @command="handleSend" trigger="click">
      <el-button type="primary" :disabled="!saveAndSend">
        发送<i class="el-icon-arrow-down el-icon--right"></i>
      </el-button>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item v-for="(item, index) in sendMenus" :command="item.id" :key="index">{{item.flowNodeName}}</el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
  </div>

</div>
</template>

<script>
import {
  saveData,
  sendNext,
  queryBindContracts
} from '@/server/initiatingprocess';

import {
  setStore,
  getStore,
  removeStore
} from '@/assets/js/common'

let vm = null;
let formProcess = (function() {
  var saveTypes = {
    businessform() {

      /*
      //保存去掉 编号提示!!!
      let required = vm.saveData.businessform_foreigntradecontract.bf_orderNumber == '' ||
        vm.saveData.businessform_pi.bp_no == '';

      vm.saveData.businessform_domestictradecontract.forEach(e => {
        required = required || (e.bd_no == '');
      });

      if (required) {
        vm.$message({
          message: "所有合同编号为必填选项",
          type: "error"
        })
        return;
      }
      */

      let changeStatusFor = {};
      changeStatusFor.PI = vm.saveData.businessform_foreigntradecontract.relatedChangedStatusPI,
      changeStatusFor.DO = vm.saveData.businessform_foreigntradecontract.relatedChangedStatusDO,
      changeStatusFor.PR = vm.saveData.businessform_foreigntradecontract.relatedChangedStatusPR;


      let statusDo = [];
      let changeStatusDo = {};
      vm.saveData.businessform_domestictradecontract.forEach(e => {
        statusDo.push(e.relatedChangedStatusPR);
      });

      changeStatusDo.PR = 0;
      if (statusDo.indexOf(1) != -1) {
        changeStatusDo.PR = 1;
      }

      let changeStatusPi = {};
      changeStatusPi.PR = vm.saveData.businessform_pi.relatedChangedStatusPR;



      if (vm.saveData.businessform_pi.hasClicked == undefined  || changeStatusFor.PI == 1) {

        if (!vm.fromOther){
          let relatedData = vm .saveData.businessform_foreigntradecontract;
          let currData = vm.saveData.businessform_pi;

          currData.bp_company = relatedData.bf_buy_name;
          currData.bp_no = relatedData.bf_orderNumber
          currData.bp_address = relatedData.bf_buy_address;
          currData.bp_date = relatedData.bf_orderDate;
          currData.bp_tradeTerm = relatedData.bf_tradeTerm;
          currData.bp_countryOfOrgin =  "中国 China";
          currData.bp_portOfLoad =  relatedData.bf_portOfLoad;
          currData.bp_portOfDestination = relatedData.bf_portOfDestination;


          currData.bp_table1.splice(2);
          for (let i = 0; i < relatedData.bf_table1.length - 1; i++) {
            if (!currData.bp_table1[i]){
              currData.bp_table1.push({});
            }
            (currData.bp_table1[i]).bp_table1_products =  (relatedData.bf_table1[i]).bf_table1_product;
            (currData.bp_table1[i]).bp_table1_description = (relatedData.bf_table1[i]).bf_table1_description;
            (currData.bp_table1[i]).bp_table1_quantity = (relatedData.bf_table1[i]).bf_table1_quantity;
            (currData.bp_table1[i]).bp_table1_price = (relatedData.bf_table1[i]).bf_table1_price;
            (currData.bp_table1[i]).bp_table1_lineAmount = (relatedData.bf_table1[i]).bf_table1_lineAmount;
          }
        }


      }

      vm.saveData.businessform_domestictradecontract.forEach(currData => {
        if (currData.hasClicked == undefined || changeStatusFor.DO == 1) {

           if (!vm.fromOther){
            let relatedData = vm.saveData.businessform_foreigntradecontract;
            currData.bd_table1.splice(2);
            for (let i = 0; i < relatedData.bf_table1.length - 1; i++) {
              if (!currData.bd_table1[i]) {
                currData.bd_table1.push({});
              }

              (currData.bd_table1[i]).bd_table1_products = (relatedData.bf_table1[i]).bf_table1_product;
              (currData.bd_table1[i]).bd_table1_description = (relatedData.bf_table1[i]).bf_table1_description;
              (currData.bd_table1[i]).bd_table1_quantity = (relatedData.bf_table1[i]).bf_table1_quantity;
              (currData.bd_table1[i]).bd_table1_price = (relatedData.bf_table1[i]).bf_table1_price;
              (currData.bd_table1[i]).bd_table1_lineAmount = (relatedData.bf_table1[i]).bf_table1_lineAmount;
            }
          }


        }
      })


      if (vm.saveData.businessform_profitcalculation.hasClicked == undefined || changeStatusFor.PR == 1 || changeStatusDo.PR == 1 || changeStatusPi.PR == 1) {

        if (!vm.fromOther) {
          let currData = vm.saveData.businessform_profitcalculation;
          let relatedData1= vm.saveData.businessform_pi;
          let relatedData2= vm.saveData.businessform_foreigntradecontract;
          let relatedData3 = vm.saveData.businessform_domestictradecontract;

          if (changeStatusPi.PR == 1 || changeStatusPi.PR == 0){
            currData.bpc_table1.splice(0);
            for (let i = 0; i < relatedData1.bp_table1.length; i++) {
              if (!currData.bpc_table1[i]){
                currData.bpc_table1.push({});
              }
              (currData.bpc_table1[i]).bpc_table1_product =  (relatedData1.bp_table1[i]).bp_table1_products;
              (currData.bpc_table1[i]).bpc_table1_hscode = (relatedData1.bp_table1[i]).bp_table1_hscode;
              (currData.bpc_table1[i]).bpc_table1_quantity = (relatedData1.bp_table1[i]).bp_table1_quantity;
              (currData.bpc_table1[i]).bpc_table1_price = (relatedData1.bp_table1[i]).bp_table1_price;
              (currData.bpc_table1[i]).bpc_table1_lineAmount = (relatedData1.bp_table1[i]).bp_table1_lineAmount;
            }
          }


          if (changeStatusFor.PR == 1 || changeStatusFor.PR == 0) {
            //表格2 关联  businessform_foreigntradecontract    relatedData2 的金额
            currData.bpc_table2[0].bpc_table2_foreignTradeContractAmount = (relatedData2.bf_table1[relatedData2.bf_table1.length - 2].bf_table1_lineAmount).toString().slice(3);
          }


          if (changeStatusDo.PR == 1 ||  changeStatusDo.PR == 0){

            //表格2 关联  businessform_domestictradecontract relatedData3 的金额
            currData.bpc_table2.splice(3);
            for (let i = 0; i < relatedData3.length; i++) {
              if (!currData.bpc_table2[i]) {
                currData.bpc_table2.push({});
              }
              let temp = relatedData3[i].bd_table1;
              currData.bpc_table2[i].bpc_table2_domesticTradeContractAmount =  temp[temp.length - 1].bd_table1_lineAmount;
            }
          }
        }



      }


      let dtcCode = [];
      vm.saveData.businessform_domestictradecontract.forEach((e) => {
        dtcCode.push(e.bd_no);
      });

      vm.saveData.roles = {};
      let temp = {
        "flowId": "1",
        "formId": "1",
        "formServiceName": "business_lading",
        "orderCode": vm.saveData.businessform_no,

        "ftcCode": vm.saveData.businessform_foreigntradecontract.bf_orderNumber,
        "buyerName": vm.saveData.businessform_foreigntradecontract.bf_buy_name,
        "dtcCode": dtcCode.join(','),
        ...vm.saveData
      };


      let data = JSON.parse(JSON.stringify(temp), function(k, v) {
        if (k === 'attachedFiles') {
          if (v != null) {
            return v.map((e) => {
              return e.id;
            }).join(',');
          }
        }
        if (typeof v == 'number') return '' + v;

        if (k === 'relationFormInstId') {
          return v.join(',');
        }
        return v;
      });


      if (vm.saveData.isSalesMan) {
        data.approvals = {};
      } else {
        let newApproval = vm.saveData.originApprovals.find((e) => {
          return e.rw == 'W';
        });

        if (newApproval) {
          newApproval.approval_div_name = newApproval.item;
          delete newApproval.item;
          delete newApproval.rw;
        } else {
          newApproval = {}
        }
        data.approvals = _.cloneDeep(newApproval);
      }

      //保存到服务器
      saveData(data).then((response) => {

        if (response.code == 1) {
          vm.$store.commit('businessform/SET_SAVE');
          vm.$router.push("/home");
          vm.$message({
            message: '保存成功！',
            type: 'success'
          });
        }
      });

    },
    buyertotcf() {

      vm.saveData.roles = {};
      let temp = {
        "flowId": "2",
        "formId": "2",
        "formServiceName": "buyertotcf",
        "orderCode": vm.saveData.orderCode,
        "ftcCode": vm.saveData.buyertotcf_bindFContracts[0],
        "buyerName": vm.saveData.buyerName,
        "dtcCode": vm.saveData.buyertotcf_bindDContracts.join(','),
        ...vm.saveData
      };


      let data = JSON.parse(JSON.stringify(temp), function(k, v) {
        if (k === 'attachedFiles') {
          if (v != null) {

            return v.map((e) => {
              return e.id;
            }).join(',');
          }
        }
        if (typeof v == 'number') return '' + v;

        if (k === 'relationFormInstId') {
          return v.join(',');
        }


        if ((k.indexOf("_bindFContracts") != -1) || (k.indexOf("_bindDContracts") != -1)) {

          return v.join(',');
        }

        return v;
      });


      if (vm.saveData.isSalesMan) {
        data.approvals = {};
      } else {
        let newApproval = vm.saveData.originApprovals.find((e) => {
          return e.rw == 'W';
        });

        if (newApproval) {
          newApproval.approval_div_name = newApproval.item;
          delete newApproval.item;
          delete newApproval.rw;
        } else {
          newApproval = {}
        }
        data.approvals = _.cloneDeep(newApproval);
      }

      //保存到服务器
      saveData(data).then((response) => {

        if (response.code == 1) {
          vm.$store.commit('buyertotcf/SET_SAVE');
          vm.$router.push("/home");
          vm.$message({
            message: '保存成功！',
            type: 'success'
          });
        }
      });
    },
    tcftofactory() {

      vm.saveData.roles = {};
      let temp = {
        "flowId": "3",
        "formId": "3",
        "formServiceName": "tcftofactory",
        "orderCode": vm.saveData.orderCode,
        "ftcCode": vm.saveData.tcftofactory_bindFContracts[0],
        "buyerName": vm.saveData.buyerName,
        "dtcCode": vm.saveData.tcftofactory_bindDContracts.join(','),
        ...vm.saveData
      };


      let data = JSON.parse(JSON.stringify(temp), function(k, v) {
        if (k === 'attachedFiles') {
          if (v != null) {
            return v.map((e) => {
              return e.id;
            }).join(',');
          }
        }
        if (typeof v == 'number') return '' + v;

        if (k === 'relationFormInstId') {
          return v.join(',');
        }

        if ((k.indexOf("_bindFContracts") != -1) || (k.indexOf("_bindDContracts") != -1)) {
          return v.join(',');
        }
        return v;
      });


      if (vm.saveData.isSalesMan) {
        data.approvals = {};
      } else {
        let newApproval = vm.saveData.originApprovals.find((e) => {
          return e.rw == 'W';
        });

        if (newApproval) {
          newApproval.approval_div_name = newApproval.item;
          delete newApproval.item;
          delete newApproval.rw;
        } else {
          newApproval = {}
        }
        data.approvals = _.cloneDeep(newApproval);
      }



      data.tcftofactory_checkedPayMethods = vm.saveData.tcftofactory_checkedPayMethods.join(',');
      data.tcftofactory_thisPaymentTypes = vm.saveData.tcftofactory_thisPaymentTypes.join(',');
      data.tcftofactory_nonPaymentTypes = vm.saveData.tcftofactory_nonPaymentTypes.join(',');

      //保存到服务器
      saveData(data).then((response) => {
          vm.$store.commit('tcftofactory/SET_SAVE');
        if (response.code == 1) {
          vm.$router.push("/home");
          vm.$message({
            message: '保存成功！',
            type: 'success'
          });
        }
      });
    },
    tcflefttofactory() {

      vm.saveData.roles = {};
      let temp = {
        "flowId": "4",
        "formId": "4",
        "formServiceName": "tcflefttofactory",
        "orderCode": vm.saveData.tcflefttofactory_qualityassurance.orderCode,
        "ftcCode": vm.saveData.tcflefttofactory_qualityassurance.tq_bindFContracts[0],
        "buyerName": vm.saveData.tcflefttofactory_qualityassurance.buyerName,
        "dtcCode": vm.saveData.tcflefttofactory_qualityassurance.tq_bindDContracts.join(','),
        ...vm.saveData
      };


      let data = JSON.parse(JSON.stringify(temp), function(k, v) {
        if (k === 'attachedFiles') {
          if (v != null) {
            return v.map((e) => {
              return e.id;
            }).join(',');
          }
        }
        if (typeof v == 'number') return '' + v;

        if (k === 'relationFormInstId') {
          return v.join(',');
        }

        if ((k.indexOf("_bindFContracts") != -1) || (k.indexOf("_bindDContracts") != -1)) {
          return v.join(',');
        }
        return v;
      });


      if (vm.saveData.isSalesMan) {
        data.approvals = {};
      } else {
        let newApproval = vm.saveData.originApprovals.find((e) => {
          return e.rw == 'W';
        });

        if (newApproval) {
          newApproval.approval_div_name = newApproval.item;
          delete newApproval.item;
          delete newApproval.rw;
        } else {
          newApproval = {}
        }
        data.approvals = _.cloneDeep(newApproval);
      }

      data.tcflefttofactory_leftapply.tl_checkedPayMethods = vm.saveData.tcflefttofactory_leftapply.tl_checkedPayMethods.join(',');
      data.tcflefttofactory_leftapply.tl_thisPaymentTypes = vm.saveData.tcflefttofactory_leftapply.tl_thisPaymentTypes.join(',');
      data.tcflefttofactory_leftapply.tl_nonPaymentTypes = vm.saveData.tcflefttofactory_leftapply.tl_nonPaymentTypes.join(',');

      //保存到服务器
      saveData(data).then((response) => {

        if (response.code == 1) {
          vm.$store.commit('tcflefttofactory/SET_SAVE');
          vm.$router.push("/home");
          vm.$message({
            message: '保存成功！',
            type: 'success'
          });
        }
      });
    },
    documentprocess() {

      vm.saveData.roles = {};
      let temp = {
        "flowId": "5",
        "formId": "5",
        "formServiceName": "documentprocess",
        ...vm.saveData,
        "orderCode": vm.saveData.documentprocess_fd.documentProcess_fd_notice.orderCode,
        "ftcCode": vm.saveData.documentprocess_fd.documentProcess_fd_notice.documentprocess_fdn_bindFContracts[0],
        "buyerName": vm.saveData.documentprocess_fd.documentProcess_fd_notice.buyerName,
        "dtcCode": vm.saveData.documentprocess_fd.documentProcess_fd_notice.documentprocess_fdn_bindDContracts.join(','),
      };

      let data = JSON.parse(JSON.stringify(temp), function(k, v) {
        if (k === 'attachedFiles') {
          if (v != null) {
            return v.map((e) => {
              return e.id;
            }).join(',');
          }
        }
        if (typeof v == 'number') return '' + v;

        if (k === 'relationFormInstId') {
          return v.join(',');
        }

        if ((k.indexOf("_bindFContracts") != -1) || (k.indexOf("_bindDContracts") != -1)) {
          return v.join(',');
        }

        if ((k == 'documentprocess_cc_df_quantityAndUnit') || (k == 'documentprocess_cc_df_weightAndUnit')) {
          return v.join(',');
        }
        return v;
      });


      if (vm.saveData.isSalesMan) {
        data.approvals = {};
      } else {
        let newApproval = vm.saveData.originApprovals.find((e) => {
          return e.rw == 'W';
        });
        if (newApproval) {
          newApproval.approval_div_name = newApproval.item;
          delete newApproval.item;
          delete newApproval.rw;
        } else {
          newApproval = {}
        }
        data.approvals = _.cloneDeep(newApproval);
      }

      //保存到服务器
      saveData(data).then((response) => {

        if (response.code == 1) {
          vm.$store.commit('documentprocess/SET_SAVE');
          // setStore("documentprocess", JSON.stringify(data));
          vm.$router.push("/home");
          vm.$message({
            message: '保存成功！',
            type: 'success'
          });
        }
      });
    },
    buyerlefttotcf() {

      vm.saveData.roles = {};
      let temp = {
        "flowId": "6",
        "formId": "6",
        "formServiceName": "buyerlefttotcf",
        ...vm.saveData,
        "orderCode": vm.saveData.orderCode,
        "ftcCode": vm.saveData.buyerlefttotcf_bindFContracts[0],
        "buyerName": vm.saveData.buyerName,
        "dtcCode": vm.saveData.buyerlefttotcf_bindDContracts.join(','),
      };


      let data = JSON.parse(JSON.stringify(temp), function(k, v) {
        if (k === 'attachedFiles') {
          if (v != null) {
            return v.map((e) => {
              return e.id;
            }).join(',');
          }
        }
        if (typeof v == 'number') return '' + v;

        if (k === 'relationFormInstId') {
          return v.join(',');
        }


        if ((k.indexOf("_bindFContracts") != -1) || (k.indexOf("_bindDContracts") != -1)) {
          return v.join(',');
        }
        return v;
      });


      if (vm.saveData.isSalesMan) {
        data.approvals = {};
      } else {
        let newApproval = vm.saveData.originApprovals.find((e) => {
          return e.rw == 'W';
        });

        if (newApproval) {
          newApproval.approval_div_name = newApproval.item;
          delete newApproval.item;
          delete newApproval.rw;
        } else {
          newApproval = {}
        }
        data.approvals = _.cloneDeep(newApproval);
      }

      //保存到服务器
      saveData(data).then((response) => {

        if (response.code == 1) {
          vm.$store.commit('buyerlefttotcf/SET_SAVE');
          vm.$router.push("/home");
          vm.$message({
            message: '保存成功！',
            type: 'success'
          });
        }
      });
    }
  };

  var sendTypes = {
    businessform(nextNodeId) {


      let changeStatusFor = {};
      changeStatusFor.PI = vm.saveData.businessform_foreigntradecontract.relatedChangedStatusPI,
      changeStatusFor.DO = vm.saveData.businessform_foreigntradecontract.relatedChangedStatusDO,
      changeStatusFor.PR = vm.saveData.businessform_foreigntradecontract.relatedChangedStatusPR;


      let statusDo = [];
      let changeStatusDo = {};
      vm.saveData.businessform_domestictradecontract.forEach(e => {
        statusDo.push(e.relatedChangedStatusPR);
      });

      changeStatusDo.PR = 0;
      if (statusDo.indexOf(1) != -1) {
        changeStatusDo.PR = 1;
      }

      let changeStatusPi = {};
      changeStatusPi.PR = vm.saveData.businessform_pi.relatedChangedStatusPR;



      if (vm.saveData.businessform_pi.hasClicked == undefined  || changeStatusFor.PI == 1) {
        if (!vm.fromOther){
          let relatedData = vm .saveData.businessform_foreigntradecontract;
          let currData = vm.saveData.businessform_pi;

          currData.bp_company = relatedData.bf_buy_name;
          currData.bp_no = relatedData.bf_orderNumber
          currData.bp_address = relatedData.bf_buy_address;
          currData.bp_date = relatedData.bf_orderDate;
          currData.bp_tradeTerm = relatedData.bf_tradeTerm;
          currData.bp_countryOfOrgin =  "中国 China";
          currData.bp_portOfLoad =  relatedData.bf_portOfLoad;
          currData.bp_portOfDestination = relatedData.bf_portOfDestination;


          currData.bp_table1.splice(2);
          for (let i = 0; i < relatedData.bf_table1.length - 1; i++) {
            if (!currData.bp_table1[i]){
              currData.bp_table1.push({});
            }
            (currData.bp_table1[i]).bp_table1_products =  (relatedData.bf_table1[i]).bf_table1_product;
            (currData.bp_table1[i]).bp_table1_description = (relatedData.bf_table1[i]).bf_table1_description;
            (currData.bp_table1[i]).bp_table1_quantity = (relatedData.bf_table1[i]).bf_table1_quantity;
            (currData.bp_table1[i]).bp_table1_price = (relatedData.bf_table1[i]).bf_table1_price;
            (currData.bp_table1[i]).bp_table1_lineAmount = (relatedData.bf_table1[i]).bf_table1_lineAmount;
          }
        }
      }

      vm.saveData.businessform_domestictradecontract.forEach(currData => {
        if (currData.hasClicked == undefined || changeStatusFor.DO == 1) {

          if (!vm.fromOther){
            let relatedData = vm.saveData.businessform_foreigntradecontract;
            currData.bd_table1.splice(2);
            for (let i = 0; i < relatedData.bf_table1.length - 1; i++) {
              if (!currData.bd_table1[i]) {
                currData.bd_table1.push({});
              }

              (currData.bd_table1[i]).bd_table1_products = (relatedData.bf_table1[i]).bf_table1_product;
              (currData.bd_table1[i]).bd_table1_description = (relatedData.bf_table1[i]).bf_table1_description;
              (currData.bd_table1[i]).bd_table1_quantity = (relatedData.bf_table1[i]).bf_table1_quantity;
              (currData.bd_table1[i]).bd_table1_price = (relatedData.bf_table1[i]).bf_table1_price;
              (currData.bd_table1[i]).bd_table1_lineAmount = (relatedData.bf_table1[i]).bf_table1_lineAmount;
            }
          }
        }
      })


      if (vm.saveData.businessform_profitcalculation.hasClicked == undefined || changeStatusFor.PR == 1 || changeStatusDo.PR == 1 || changeStatusPi.PR == 1) {

        if (!vm.fromOther){
          let currData = vm.saveData.businessform_profitcalculation;
          let relatedData1= vm.saveData.businessform_pi;
          let relatedData2= vm.saveData.businessform_foreigntradecontract;
          let relatedData3 = vm.saveData.businessform_domestictradecontract;

          if (changeStatusPi.PR == 1 || changeStatusPi.PR == 0){
            currData.bpc_table1.splice(0);
            for (let i = 0; i < relatedData1.bp_table1.length; i++) {
              if (!currData.bpc_table1[i]){
                currData.bpc_table1.push({});
              }
              (currData.bpc_table1[i]).bpc_table1_product =  (relatedData1.bp_table1[i]).bp_table1_products;
              (currData.bpc_table1[i]).bpc_table1_hscode = (relatedData1.bp_table1[i]).bp_table1_hscode;
              (currData.bpc_table1[i]).bpc_table1_quantity = (relatedData1.bp_table1[i]).bp_table1_quantity;
              (currData.bpc_table1[i]).bpc_table1_price = (relatedData1.bp_table1[i]).bp_table1_price;
              (currData.bpc_table1[i]).bpc_table1_lineAmount = (relatedData1.bp_table1[i]).bp_table1_lineAmount;
            }
          }


        if (changeStatusFor.PR == 1 || changeStatusFor.PR == 0) {
          //表格2 关联  businessform_foreigntradecontract    relatedData2 的金额
          currData.bpc_table2[0].bpc_table2_foreignTradeContractAmount = (relatedData2.bf_table1[relatedData2.bf_table1.length - 2].bf_table1_lineAmount).toString().slice(3);
        }


        if (changeStatusDo.PR == 1 ||  changeStatusDo.PR == 0){

          //表格2 关联  businessform_domestictradecontract relatedData3 的金额
          currData.bpc_table2.splice(3);
          for (let i = 0; i < relatedData3.length; i++) {
            if (!currData.bpc_table2[i]) {
              currData.bpc_table2.push({});
            }
            let temp = relatedData3[i].bd_table1;
            currData.bpc_table2[i].bpc_table2_domesticTradeContractAmount =  temp[temp.length - 1].bd_table1_lineAmount;
          }
        }
        }
      }




      let required = vm.saveData.businessform_foreigntradecontract.bf_orderNumber == '' ||
        vm.saveData.businessform_pi.bp_no == '' || vm.saveData.businessform_profitcalculation.bpc_no == '';

      vm.saveData.businessform_domestictradecontract.forEach(e => {
        required = required || (e.bd_no == '');
      });

      if (required) {
        vm.$message({
          message: "所有合同编号为必填选项",
          type: "error"
        })
        return;
      }

      let dtcCode = [];
      vm.saveData.businessform_domestictradecontract.forEach((e) => {
        dtcCode.push(e.bd_no);
      });

      vm.saveData.roles = {};
      let temp = {
        "flowId": "1",
        "formId": "1",
        "formServiceName": "business_lading",
        "orderCode": vm.saveData.businessform_no,

        "ftcCode": vm.saveData.businessform_foreigntradecontract.bf_orderNumber,
        "buyerName": vm.saveData.businessform_foreigntradecontract.bf_buy_name,
        "dtcCode": dtcCode.join(','),
        "nextNodeId": nextNodeId,
        ...vm.saveData
      };


      let data = JSON.parse(JSON.stringify(temp), function(k, v) {
        if (k === 'attachedFiles') {
          if (v != null) {
            return v.map((e) => {
              return e.id;
            }).join(',');
          }
        }

        if (typeof v == 'number') return '' + v;

        if (k === 'relationFormInstId') {
          return v.join(',');
        }
        return v;
      });


      if (vm.saveData.isSalesMan) {
        data.approvals = {};
      } else {
        let date = new Date();
        let newApproval = vm.saveData.originApprovals.find((e) => {
          return e.rw == 'W';
        });

        if (newApproval) {

          if (newApproval.approval_opinion == '') {
            vm.$message({
              message: '必须填写审批意见',
              type: 'warning'
            });
            return;
          }


          newApproval.approval_div_name = newApproval.item;
          delete newApproval.item;
          delete newApproval.rw;
        } else {
          newApproval = {}
        }
        data.approvals = _.cloneDeep(newApproval);
      }


      sendNext(data).then((response) => {
        if (response.code == 1) {
          vm.$store.commit('businessform/SET_SAVE');
          vm.$router.push("/home");
          vm.$message({
            message: '发送成功！',
            type: 'success'
          });
        }
      }).catch(() => {
        vm.$message({
          message: "服务器请求失败",
          type: 'error'
        })
      });


    },
    buyertotcf(nextNodeId) {

      vm.saveData.roles = {};
      let temp = {
        "flowId": "2",
        "formId": "2",
        "formServiceName": "buyertotcf",
        "orderCode": vm.saveData.orderCode,
        "ftcCode": vm.saveData.buyertotcf_bindFContracts[0],
        "buyerName": vm.saveData.buyerName,
        "dtcCode": vm.saveData.buyertotcf_bindDContracts.join(','),
        "nextNodeId": nextNodeId,
        ...vm.saveData
      };


      let data = JSON.parse(JSON.stringify(temp), function(k, v) {
        if (k === 'attachedFiles') {
          if (v != null) {
            return v.map((e) => {
              return e.id;
            }).join(',');
          }
        }
        if (typeof v == 'number') return '' + v;

        if (k === 'relationFormInstId') {
          return v.join(',');
        }

        if ((k.indexOf("_bindFContracts") != -1) || (k.indexOf("_bindDContracts") != -1)) {
          return v.join(',');
        }
        return v;
      });


      if (vm.saveData.isSalesMan) {
        data.approvals = {};
      } else {
        let newApproval = vm.saveData.originApprovals.find((e) => {
          return e.rw == 'W';
        });
        if (newApproval) {
          if (newApproval.approval_opinion == '') {
            vm.$message({
              message: '必须填写审批意见',
              type: 'warning'
            });
            return;
          }

          newApproval.approval_div_name = newApproval.item;
          delete newApproval.item;
          delete newApproval.rw;
        } else {
          newApproval = {}
        }
        data.approvals = _.cloneDeep(newApproval);
      }


      sendNext(data).then((response) => {
        if (response.code == 1) {
          vm.$store.commit('buyertotcf/SET_SAVE');
          vm.$router.push("/home");
          vm.$message({
            message: '发送成功！',
            type: 'success'
          });
        }
      }).catch(() => {
        vm.$message({
          message: "服务器请求失败",
          type: 'error'
        })
      });
    },
    tcftofactory(nextNodeId) {

      vm.saveData.roles = {};
      let temp = {
        "flowId": "3",
        "formId": "3",
        "formServiceName": "tcftofactory",
        "orderCode": vm.saveData.orderCode,
        "ftcCode": vm.saveData.tcftofactory_bindFContracts[0],
        "buyerName": vm.saveData.buyerName,
        "dtcCode": vm.saveData.tcftofactory_bindDContracts.join(','),
        "nextNodeId": nextNodeId,
        ...vm.saveData
      };


      let data = JSON.parse(JSON.stringify(temp), function(k, v) {
        if (k === 'attachedFiles') {
          if (v != null) {
            return v.map((e) => {
              return e.id;
            }).join(',');
          }
        }
        if (typeof v == 'number') return '' + v;

        if (k === 'relationFormInstId') {
          return v.join(',');
        }

        if ((k.indexOf("_bindFContracts") != -1) || (k.indexOf("_bindDContracts") != -1)) {
          return v.join(',');
        }
        return v;
      });


      if (vm.saveData.isSalesMan) {
        data.approvals = {};
      } else {
        let newApproval = vm.saveData.originApprovals.find((e) => {
          return e.rw == 'W';
        });
        if (newApproval) {
          if (newApproval.approval_opinion == '') {
            vm.$message({
              message: '必须填写审批意见',
              type: 'warning'
            });
            return;
          }

          newApproval.approval_div_name = newApproval.item;
          delete newApproval.item;
          delete newApproval.rw;
        } else {
          newApproval = {}
        }
        data.approvals = _.cloneDeep(newApproval);
      }


      data.tcftofactory_checkedPayMethods = vm.saveData.tcftofactory_checkedPayMethods.join(',');
      data.tcftofactory_thisPaymentTypes = vm.saveData.tcftofactory_thisPaymentTypes.join(',');
      data.tcftofactory_nonPaymentTypes = vm.saveData.tcftofactory_nonPaymentTypes.join(',');


      sendNext(data).then((response) => {
        if (response.code == 1) {
          vm.$store.commit('tcftofactory/SET_SAVE');
          vm.$router.push("/home");
          vm.$message({
            message: '发送成功！',
            type: 'success'
          });
        }
      }).catch(() => {
        vm.$message({
          message: "服务器请求失败",
          type: 'error'
        })
      });

    },
    tcflefttofactory(nextNodeId) {

      vm.saveData.roles = {};
      let temp = {
        "flowId": "4",
        "formId": "4",
        "formServiceName": "tcflefttofactory",
        "orderCode": vm.saveData.tcflefttofactory_qualityassurance.orderCode,
        "ftcCode": vm.saveData.tcflefttofactory_qualityassurance.tq_bindFContracts[0],
        "buyerName": vm.saveData.tcflefttofactory_qualityassurance.buyerName,
        "dtcCode": vm.saveData.tcflefttofactory_qualityassurance.tq_bindDContracts.join(','),
        "nextNodeId": nextNodeId,
        ...vm.saveData,
      };


      let data = JSON.parse(JSON.stringify(temp), function(k, v) {
        if (k === 'attachedFiles') {
          if (v != null) {
            return v.map((e) => {
              return e.id;
            }).join(',');
          }
        }
        if (typeof v == 'number') return '' + v;

        if (k === 'relationFormInstId') {
          return v.join(',');
        }

        if ((k.indexOf("_bindFContracts") != -1) || (k.indexOf("_bindDContracts") != -1)) {
          return v.join(',');
        }
        return v;
      });


      if (vm.saveData.isSalesMan) {
        data.approvals = {};
      } else {
        let newApproval = vm.saveData.originApprovals.find((e) => {
          return e.rw == 'W';
        });

        if (newApproval) {
          if (newApproval.approval_opinion == '') {
            vm.$message({
              message: '必须填写审批意见',
              type: 'warning'
            });
            return;
          }

          newApproval.approval_div_name = newApproval.item;
          delete newApproval.item;
          delete newApproval.rw;
        } else {
          newApproval = {}
        }
        data.approvals = _.cloneDeep(newApproval);
      }

      data.tcflefttofactory_leftapply.tl_checkedPayMethods = vm.saveData.tcflefttofactory_leftapply.tl_checkedPayMethods.join(',');
      data.tcflefttofactory_leftapply.tl_thisPaymentTypes = vm.saveData.tcflefttofactory_leftapply.tl_thisPaymentTypes.join(',');
      data.tcflefttofactory_leftapply.tl_nonPaymentTypes = vm.saveData.tcflefttofactory_leftapply.tl_nonPaymentTypes.join(',');



      sendNext(data).then((response) => {
        if (response.code == 1) {
          vm.$store.commit('tcflefttofactory/SET_SAVE');
          vm.$router.push("/home");
          vm.$message({
            message: '发送成功！',
            type: 'success'
          });
        }
      }).catch(() => {
        vm.$message({
          message: "服务器请求失败",
          type: 'error'
        })
      });

    },
    documentprocess(nextNodeId) {

      vm.saveData.roles = {};
      let temp = {
        "flowId": "5",
        "formId": "5",
        "formServiceName": "documentprocess",
        ...vm.saveData,
        "orderCode": vm.saveData.documentprocess_fd.documentProcess_fd_notice.orderCode,
        "ftcCode": vm.saveData.documentprocess_fd.documentProcess_fd_notice.documentprocess_fdn_bindFContracts[0],
        "buyerName": vm.saveData.documentprocess_fd.documentProcess_fd_notice.buyerName,
        "dtcCode": vm.saveData.documentprocess_fd.documentProcess_fd_notice.documentprocess_fdn_bindDContracts.join(','),
        "nextNodeId": nextNodeId,
      };


      let data = JSON.parse(JSON.stringify(temp), function(k, v) {
        if (k === 'attachedFiles') {
          if (v != null) {
            return v.map((e) => {
              return e.id;
            }).join(',');
          }
        }
        if (typeof v == 'number') return '' + v;

        if (k === 'relationFormInstId') {
          return v.join(',');
        }


        if ((k.indexOf("_bindFContracts") != -1) || (k.indexOf("_bindDContracts") != -1)) {
          return v.join(',');
        }

        if ((k == 'documentprocess_cc_df_quantityAndUnit') || (k == 'documentprocess_cc_df_weightAndUnit')) {
          return v.join(',');
        }
        return v;
      });


      if (vm.saveData.isSalesMan) {
        data.approvals = {};
      } else {
        let newApproval = vm.saveData.originApprovals.find((e) => {
          return e.rw == 'W';
        });

        if (newApproval) {
          if (newApproval.approval_opinion == '') {
            vm.$message({
              message: '必须填写审批意见',
              type: 'warning'
            });
            return;
          }

          newApproval.approval_div_name = newApproval.item;
          delete newApproval.item;
          delete newApproval.rw;
        } else {
          newApproval = {}
        }
        data.approvals = _.cloneDeep(newApproval);
      }


      sendNext(data).then((response) => {
        if (response.code == 1) {
          vm.$store.commit('documentprocess/SET_SAVE');
          // setStore("documentprocess", JSON.stringify(data));
          vm.$router.push("/home");
          vm.$message({
            message: '发送成功！',
            type: 'success'
          });
        }
      }).catch(() => {
        vm.$message({
          message: "服务器请求失败",
          type: 'error'
        })
      });

    },
    buyerlefttotcf(nextNodeId) {

      vm.saveData.roles = {};
      let temp = {
        "flowId": "6",
        "formId": "6",
        "formServiceName": "buyerlefttotcf",
        ...vm.saveData,
        "orderCode": vm.saveData.orderCode,
        "ftcCode": vm.saveData.buyerlefttotcf_bindFContracts[0],
        "buyerName": vm.saveData.buyerName,
        "dtcCode": vm.saveData.buyerlefttotcf_bindDContracts.join(','),
        "nextNodeId": nextNodeId,
      };


      let data = JSON.parse(JSON.stringify(temp), function(k, v) {
        if (k === 'attachedFiles') {
          if (v != null) {
            return v.map((e) => {
              return e.id;
            }).join(',');
          }
        }
        if (typeof v == 'number') return '' + v;

        if (k === 'relationFormInstId') {
          return v.join(',');
        }


        if ((k.indexOf("_bindFContracts") != -1) || (k.indexOf("_bindDContracts") != -1)) {
          return v.join(',');
        }
        return v;
      });


      if (vm.saveData.isSalesMan) {
        data.approvals = {};
      } else {
        let newApproval = vm.saveData.originApprovals.find((e) => {
          return e.rw == 'W';
        });
        if (newApproval) {
          if (newApproval.approval_opinion == '') {
            vm.$message({
              message: '必须填写审批意见',
              type: 'warning'
            });
            return;
          }

          newApproval.approval_div_name = newApproval.item;
          delete newApproval.item;
          delete newApproval.rw;
        } else {
          newApproval = {}
        }
        data.approvals = _.cloneDeep(newApproval);
      }


      sendNext(data).then((response) => {
        if (response.code == 1) {
          vm.$store.commit('buyerlefttotcf/SET_SAVE');
          vm.$router.push("/home");
          vm.$message({
            message: '发送成功！',
            type: 'success'
          });
        }
      }).catch(() => {
        vm.$message({
          message: "服务器请求失败",
          type: 'error'
        })
      });

    }
  };

  /*
  operation @String save  or send
  type @String  流程的名称
  **/
  return function(operation, type, nextNodeId) {
    switch (operation) {
      case 'save':
        return saveTypes[type]();
      case 'send':
        return sendTypes[type](nextNodeId);
    }
  };
})();

export default {
  created() {
    vm = this;

    this.relationFormInstId = [];
    this.saveData.relationFormInstId.forEach(e=>{
      this.relationFormInstId.push({
        name: e.orderCode,
        status: 1
      });
    });

  },
  mounted() {
    let that = this;
    let closeDom = document.querySelectorAll('.fixedform  .bind-window i.el-dialog__close.el-icon-close');
    for (let i = 0; i < closeDom.length; i++) {
      closeDom[i].onclick = function() {
        that.bindOuterCancel();
      };
    }
  },
  updated() {
    if (this.isForceUpdate){
      this.relationFormInstId = [];
      this.saveData.relationFormInstId.forEach(e=>{
        this.relationFormInstId.push({
          name: e.orderCode,
          status: 1
        });
      });

      this.isForceUpdate = false;
    }
  },
  watch: {
    /*
    checkedFOrder(value){
      if (value.length == 0){
        this.canNotSelect = true;
      } else {
        this.canNotSelect = false;
      }
    }
    */
  },
  methods: {

    //关联订单修改为单选
    checkBox(event){
      var value = parseInt(event.target.value);
      if (value == this.checkedFOrder[0]){
        this.canNotSelect = true;
      } else {
        this.canNotSelect = false;
      }

      this.checkedFOrder = [value];
    },
    saveForms() {
      formProcess("save", this.processName);
    },
    sendForms(nextNodeId) {
      formProcess("send", this.processName, nextNodeId);
    },
    changeSelect(index) {
      (this.saveData.relationFormInstId).splice(index, 1);
      this.relationFormInstId.splice(index, 1);

      this.$forceUpdate();
    },

    handleSizeChange(size){
      this.page.pageSize = size;
      //需要重新查询
      this.queryFtc(1, this.page.pageSize);
    },
    handleCurrentChange(currPage){
      this.page.currPage = currPage;
      //需要重新查询
      this.queryFtc(this.page.currPage, this.page.pageSize);
    },

    bindOrder() {
      this.dialogCtrl.outerVisible = true;
      this.queryFtc(1, 30);
    },
    queryFtc(currPage, pageSize) {
      //通过查询来获得外贸合同订单，并修改table1的数据来进行显示

      if (currPage ==  -1){
        currPage = 1;
        this.page.currPage = 1;
        pageSize = this.page.pageSize;
      }


      this.loading = true;

      queryBindContracts({
        flowId: 1,
        orderCode: this.orderNumber,
        ftcCode: this.foreignTradeContractNumber,
        buyerName: this.buyerName,
        currPage: currPage - 1,
        pageSize: pageSize
      }).then((response) => {

        this.table1Data = [];

        this.loading = false;
        this.page.totalSize = response.data.totalSize;

        let data = response.data.datas;
        this.queryOrderData = data;

        let table1Data = this.table1Data;
        for (let i = 0; i < data.length; i++) {

          if (!table1Data[i]) {
            table1Data[i] = {};
          }
          table1Data[i].table1_orderNumber = data[i].orderCode;
          table1Data[i].table1_ftcNumber = data[i].ftcCode;
          table1Data[i].table1_buyerName = data[i].buyerName;
          table1Data[i].table1_id = data[i].id;


          switch(data[i].formInstStatus){
            case 0:
            case 1:
            table1Data[i].table1_orderStatus = '流转中';
            break;
            case 2:
            table1Data[i].table1_orderStatus = '完结';
            break;
          }

          table1Data[i].table1_orderProcess = data[i].flowName;
        }
        this.$forceUpdate();
      });

    },
    table1Sort(a, b) {
      let a1 = a.toString().slice(a.length - 5);
      let b1 = b.toString().slice(b.length - 5);
      return parseInt(b) - parseInt(b);
    },
    bindOuterCancel() {
      this.dialogCtrl.outerVisible = false;
      this.checkedFOrder = [];
      this.page.pageSize = 30;
    },
    bindOuterConfirm() {
      this.dialogCtrl.outerVisible = false;

      this.saveData.relationFormInstId = [];
      this.relationFormInstId = [];
      this.queryOrderData.forEach(e =>{
         // if (this.checkedFOrder.indexOf(e.orderCode) != -1){
         //   this.saveData.relationFormInstId.push(e.id);
         //   this.relationFormInstId.push({name: e.orderCode, status: 1});
         // }

         if (this.checkedFOrder.indexOf(e.id) != -1){
           this.saveData.relationFormInstId.push(e.id);
           this.relationFormInstId.push({name: e.orderCode, status: 1});
         }
      });

      ////


      this.page.pageSize = 30;

      this.table1Data.forEach((e, i, a) => {
        if (this.checkedFOrder.indexOf(e.table1_orderNumber) !== -1) {
          //显示选中的外贸合同
          // this.saveData[this.processName + '_relatedcontracts'].push(e);
          // this.saveData.relationFormInstId.push(e);
        }
      });
      this.$forceUpdate();
    },
    handleSend(command) {
      this.sendForms(command);
    },
    handleOver(item) {
      item.status = 0;
      this.$forceUpdate();
    },
    handleOut(item) {
      item.status = 1;
      this.$forceUpdate();
    },
  },
  props: {
    processName: {
      type: String,
      required: true
    },
    saveData: {
      type: Object,
      required: true
    },
    sendMenus: {
      type: Array,
      required: true
    },
    editable: {
      type: Boolean,
      required: true,
    },
    saveAndSend: {
      type: Boolean,
      required: true
    },
    fromOther: {
      type: Boolean,
      default: false
    } 
  },
  data() {
    return {
      dialogCtrl: {
        outerVisible: false,
      },
      canNotSelect: true,
      page: {
        currPage: 1,
        pageSize: 30,
        totalSize: 0
      },
      relationFormInstId: [],
      showClose: false,
      loading: false,
      orderStatus: '全部',
      orderStatusOptions: [{
        value: '全部',
        label: '全部'
      }, {
        value: '流程中',
        label: '流程中'
      }, {
        value: '取消',
        label: '取消'
      }],
      orderProcess: '全部',
      orderProcessOptions: [{
        value: '全部',
        label: '全部'
      }, {
        value: '1',
        label: '1'
      }, {
        value: '2',
        label: '2'
      }, {
        value: '3',
        label: '3'
      }, {
        value: '4',
        label: '4'
      }, {
        value: '5-8',
        label: '5-8'
      }, {
        value: '9',
        label: '9'
      }],
      orderNumber: '',
      foreignTradeContractNumber: '',
      buyerName: '',
      checkedFOrder: [],
      table1Data: [],
      queryOrderData: [],
      approvalResultsInitial: [],
      isForceUpdate: false,
    }
  },
  computed: {}
}
</script>

<style lang="scss">
.fixedform {
    padding: 20px 40px;

    .active {
        .el-input__inner {
            border: 1px solid #e6a23c;
        }
    }

    .el-input__inner {
        border: 1px solid #999;
        padding: 10px;
    }

    .part {
        padding: 20px 0;

        .related {
            padding: 20px 0;
            font-size: 16px;

            > li {
                width: 300px;
                height: 40px;
                line-height: 40px;

                span {
                  cursor: pointer;
                }

                span.related-number {
                    color: #409EFF;
                }

                span.el-icon-circle-close {
                    color:red;
                }

                > span {
                    padding: 0 10px;
                }
            }
        }
    }
    .title {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .approval {
        ul {
            border: 1px solid #999;
            border-radius: 5px;
        }

        li {
            padding: 10px;
            height: 40px;
            line-height: 40px;
        }

        li+li {
            border-top: 1px solid #999;
        }
        .result {
            float: left;
        }

        .officer {
            float: right;
        }
    }

    .btns {
        text-align: center;

        button {
            margin-right: 80px;
        }
    }

    .bind-window {
        .el-form--inline .el-form-item {
            margin-right: 15px;
        }

        td {
            border: 1px solid #e6ebf5;
        }

        td:not(.el-table_1_column_1) {
            width: 120px;
            min-width: 120px;
        }

        .dialog-footer {
            text-align: center;
            button {
                margin-right: 80px;
            }
        }

        a {
            color: #409EFF;
        }
    }
}
</style>
